import 'package:flutter/material.dart';
import 'package:flutter_base_study/pageview/view/swiper_page.dart';

/**
 * 自动轮播图 缓存
 */
class PageViewSwiperAutoDemo extends StatefulWidget {
  const PageViewSwiperAutoDemo({super.key});

  @override
  State<PageViewSwiperAutoDemo> createState() => _PageViewSwiperAutoDemoState();
}

class _PageViewSwiperAutoDemoState extends State<PageViewSwiperAutoDemo> {
  List<String> list = [];

  @override
  void initState() {
    super.initState();
    list = [
      'https://img0.baidu.com/it/u=2881522803,771576777&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500',
      'https://img0.baidu.com/it/u=756784717,4222282671&fm=253&fmt=auto&app=138&f=JPEG?w=690&h=388',
      'https://img0.baidu.com/it/u=3411979318,2994476395&fm=253&fmt=auto&app=138&f=JPG?w=681&h=418',
    ];
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('自动轮播图'),
      ),
      body: PageView(
        children: [
          SwiperPage(
            list: list,
          )
        ],
      ),
    );
  }
}
